package io.renren.modules.shippinginformation.service.impl;

import io.renren.modules.deliveryman.entity.DeliveryManEntity;
import io.renren.modules.waybillorder.entity.WaybillOrderEntity;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.shippinginformation.dao.ShippingInformationDao;
import io.renren.modules.shippinginformation.entity.ShippingInformationEntity;
import io.renren.modules.shippinginformation.service.ShippingInformationService;


@Service("shippingInformationService")
public class ShippingInformationServiceImpl extends ServiceImpl<ShippingInformationDao, ShippingInformationEntity> implements ShippingInformationService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<ShippingInformationEntity> shippingInformationEntityQueryWrapper = new QueryWrapper<>();
        if (StringUtils.isNotBlank((String)params.get("waybillno"))){
            shippingInformationEntityQueryWrapper.lambda().eq(ShippingInformationEntity::getId,params.get("waybillno"));
        }
        shippingInformationEntityQueryWrapper.lambda().orderByDesc(ShippingInformationEntity::getCreatetime);
        IPage<ShippingInformationEntity> page = this.page(
                new Query<ShippingInformationEntity>().getPage(params), shippingInformationEntityQueryWrapper);
        return new PageUtils(page);
    }

}